<template>
  <div>
    <el-button
      @click="
        () => {
          delVisitedView(route)
          $router.back()
        }
      "
      >返回</el-button
    >
  </div>
  <el-tabs v-model="activeTab">
    <el-tab-pane v-for="(i, index) in tabs" :key="index" :label="i.label" :name="i.name">
      <Tab :title-type="i.name" :company="company" :ref="(el) => tabRef.push(el as TabType)" />
    </el-tab-pane>
  </el-tabs>
</template>
<script setup lang="ts">
import Tab from './components/Tab.vue'
import { useTagsViewStore } from '@/store/modules/tagsView'

const route = useRoute()
const company = decodeURIComponent(route.params.company as string)
const { delVisitedView } = useTagsViewStore()

defineOptions({
  name: 'PlatformInformationCompany'
})

type TabType = InstanceType<typeof Tab>

const tabs = [
  {
    label: '项目采购商机',
    name: 0
  },
  {
    label: '项目分包商机',
    name: 1
  },
  {
    label: '集中招募商机',
    name: 2
  }
]

const activeTab = ref(0)
const tabRef = ref<TabType[]>([])

onActivated(() => {
  tabRef.value.forEach((i) => {
    i.getList()
  })
})
</script>
<style lang="scss" scoped></style>
